import React from "react";
import store from "@/store";
import { updateMovieList } from "../../store/actions/movieActions";

export default function Movie() {
  const { movieList } = store.getState().movie;

  return (
    <div>
      <h1>Movie</h1>
      <p>当前的count值是{store.getState().count}</p>
      <button
        onClick={() => {
          store.dispatch(updateMovieList());
        }}
      >
        获取电影列表
      </button>
      <ul>
        {movieList.map((item) => {
          return (
            <li key={item.tvId}>
              <h3>{item.name}</h3>
              <p>{item.description}</p>
            </li>
          );
        })}
      </ul>
    </div>
  );
}
